package com.elow.testffmpeg.Demo3;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.RelativeLayout;

import com.elow.testffmpeg.R;

public class Demo3Activity extends Activity {

    private CameraGLSurfaceView mGLView = null;
    private DrawYUVView mDrawView = null;
    private CameraView cameraView = null;
    private RelativeLayout previewLayout = null,GLpreviewLayout = null,DrawpreviewLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //创建一个GLSurfaceView实例然后设置为activity的ContentView.
        //
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_demo4);
        RelativeLayout.LayoutParams layoutParams = null;

        //GL绘制窗口
        GLpreviewLayout = findViewById(R.id.GLpreviewLayout);
        layoutParams = new RelativeLayout.LayoutParams(640,480);
        mGLView = new CameraGLSurfaceView(this);
        GLpreviewLayout.addView(mGLView, layoutParams);
//
//        //绘制视频窗口
//        DrawpreviewLayout = (RelativeLayout)findViewById(R.id.DrawpreviewLayout);
//        layoutParams = new RelativeLayout.LayoutParams(640,480);
//        mDrawView = new DrawYUVView(this);
//        DrawpreviewLayout.addView(mDrawView, layoutParams);

        //视频窗口
        previewLayout =findViewById(R.id.previewLayout);
        layoutParams = new RelativeLayout.LayoutParams(640,480 );
        cameraView = new CameraView(this);
        cameraView.setSaveFrameCallback(mGLView);
        //cameraView.setDarwYUVFrameCallback(mDrawView);
        previewLayout.addView(cameraView, layoutParams);
    }
}
